package model;

import java.time.LocalDate;

public class Magazine extends Resource {
    private final int issueNumber;
    private final LocalDate publicationDate;
    private static final int LOAN_PERIOD = 14; // 14天借阅期

    public Magazine(String id, String title, int issueNumber, LocalDate publicationDate) {
        super(id, title);
        this.issueNumber = issueNumber;
        this.publicationDate = publicationDate;
    }

    @Override
    public String getDetails() {
        return String.format("Magazine: %s\nIssue: %d\nPublication Date: %s\nID: %s",
                getTitle(), issueNumber, publicationDate, getId());
    }

    @Override
    public boolean borrow(String borrowerId) {
        return super.borrow(borrowerId, LOAN_PERIOD);
    }

    // Magazine特有方法
    public int getIssueNumber() { return issueNumber; }
    public LocalDate getPublicationDate() { return publicationDate; }
}
